home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_1599 / 1222 < prev    next >
Encoding:
Internet Message Format  |  1994-08-27  |  5.6 KB

  1. Subject: more 1.10 patches...
  2. Date: Sun, 20 Mar 94 19:30:04 CET
  3. From: Juergen Lock <nox@jelal.north.de>
  4. Message-Id: <9403201830.AA00594@jelal.north.de>
  5.  
  6. 1. here is a reason for dropped characters on modem1...  the kernel itself
  7. did sometimes run at level 7 for long periods of time!  it was also a
  8. cause for the occasional lockup when you start/stop debug messages on
  9. console, and possibly other things too.  i hope this fix is ok (select
  10. calls check_sigs at int level < 7 now), it seems to work for me...
  11.  
  12. Index: proc.c
  13. @@ -9,7 +9,7 @@
  14.  #include "mint.h"
  15.  #include "xbra.h"
  16.  
  17. -static void do_wakeup_things P_((void));
  18. +static void do_wakeup_things P_((short sr));
  19.  
  20.  extern short proc_clock;
  21.  
  22. @@ -419,7 +419,8 @@
  23.   */
  24.  
  25.  static void
  26. -do_wakeup_things()
  27. +do_wakeup_things(sr)
  28. +short sr;
  29.  {
  30.  /*
  31.   * check for stack underflow, just in case
  32. @@ -429,28 +430,32 @@
  33.  
  34.      p = curproc;
  35.  
  36. -    if ( p->pid != 0 &&
  37. -         ((long)&foo) < (long)p->stack + ISTKSIZE + 512 ) {
  38. -        ALERT("stack underflow");
  39. -        handle_sig(SIGBUS);
  40. -    }
  41. +    if ((sr & 0x700) < 0x500) {
  42. +/* skip all this if int level is too high */
  43. +
  44. +        if ( p->pid != 0 &&
  45. +             ((long)&foo) < (long)p->stack + ISTKSIZE + 512 ) {
  46. +            ALERT("stack underflow");
  47. +            handle_sig(SIGBUS);
  48. +        }
  49.  
  50.  /* see if process' time limit has been exceeded */
  51.  
  52. -    if (p->maxcpu) {
  53. -        if (p->maxcpu <= p->systime + p->usrtime) {
  54. -            DEBUG(("cpu limit exceeded"));
  55. -            raise(SIGXCPU);
  56. +        if (p->maxcpu) {
  57. +            if (p->maxcpu <= p->systime + p->usrtime) {
  58. +                DEBUG(("cpu limit exceeded"));
  59. +                raise(SIGXCPU);
  60. +            }
  61.          }
  62. -    }
  63.  
  64.  /*
  65.   * check for alarms and similar time out stuff (see timeout.c)
  66.   */
  67.  
  68. -    checkalarms();
  69. -    if (p->sigpending)
  70. -        check_sigs();        /* check for signals */
  71. +        checkalarms();
  72. +        if (p->sigpending)
  73. +            check_sigs();        /* check for signals */
  74. +    }
  75.  
  76.      proc_clock = TIME_SLICE;    /* get a fresh time slice */
  77.      p->slices = SLICES(p->curpri);
  78. @@ -481,19 +486,22 @@
  79.   * special keys like CTRL-ALT-Fx
  80.   */
  81.  
  82. -    if (kintr) {
  83. +    sr = spl7();
  84. +    if (kintr && (sr & 0x700) < 0x500) {
  85. +/* can't call checkkeys if sleep was called with interrupts off  -nox */
  86. +        spl(sr);
  87.          (void)checkkeys();
  88. +        sr = spl7();
  89.          kintr = 0;
  90.      }
  91.  
  92.      if (que == READY_Q && !sys_q[READY_Q]) {
  93.  /* we're just going to wake up again right away! */
  94. -        do_wakeup_things();
  95. +        spl(sr);
  96. +        do_wakeup_things(sr);
  97.          return (onsigs != curproc->nsigs);
  98.      }
  99.  
  100. -    sr = spl7();
  101. -
  102.      add_q(que, curproc);
  103.      curproc->wait_cond = cond;
  104.  
  105. @@ -558,7 +565,7 @@
  106.  #endif
  107.              *((void **)0x44eL) = curproc->logbase;
  108.  #endif
  109. -        do_wakeup_things();
  110. +        do_wakeup_things(sr);
  111.          return (onsigs != curproc->nsigs);
  112.      }
  113.  /*
  114. Index: dosfile.c
  115. @@ -1053,12 +1053,21 @@
  116.              t = 0;
  117.          }
  118.  
  119. +        TRACE(("sleeping in Fselect"));
  120.          sr = spl7();
  121.  
  122.      /* curproc->wait_cond changes when data arrives or the timeout happens */
  123.          while (curproc->wait_cond == (long)wakeselect) {
  124. +#if 0
  125. +/* better not call BIOS with interrupts off, especially not Bconin... :) */
  126.              TRACE(("sleeping in Fselect"));
  127. +#endif
  128.              sleep(SELECT_Q, (long)wakeselect);
  129. +            if (curproc->sigpending) {
  130. +                spl(sr);    /* check for signals */
  131. +                check_sigs();
  132. +                sr = spl7();
  133. +            }
  134.          }
  135.          spl(sr);
  136.  
  137. 2. a new try a reducing those Pexec/Mshrink/Malloc failed races,
  138. give new processes 3 slices and make run_next use its 2nd arg.
  139. (hi Eero, does this help? :)
  140.  
  141. Index: dosmem.c
  142. @@ -641,9 +641,9 @@
  143.              }
  144.  
  145.          /* OK, let's run our new code */
  146. -        /* we guarantee ourselves at least 2 timeslices to do an Mshrink */
  147. +        /* we guarantee ourselves at least 3 timeslices to do an Mshrink */
  148.              assert(curproc->magic == CTXT_MAGIC);
  149. -            fresh_slices(2);
  150. +            fresh_slices(3);
  151.              leave_kernel();
  152.              change_context(&(curproc->ctxt[CURRENT]));
  153.          }
  154. @@ -652,7 +652,7 @@
  155.      /* so we temporarily give it high priority and put it first on the
  156.       * run queue
  157.       */
  158. -            run_next(p, 2);
  159. +            run_next(p, 3);
  160.          }
  161.      }
  162.  
  163. @@ -697,6 +697,8 @@
  164.          yield();    /* let the new process run */
  165.          return newpid;
  166.      } else {
  167. +        /* guarantee ourselves at least 3 timeslices to do an Mshrink */
  168. +        fresh_slices(3);
  169.          TRACE(("leaving Pexec with basepage address %lx", base->loc));
  170.          return base->loc;
  171.      }
  172. Index: proc.c
  173. @@ -290,8 +290,10 @@
  174.      PROC *p;
  175.  
  176.      for (p = proclist; p; p = p->gl_next) {
  177. -        p->curpri = p->pri;
  178. -        p->slices = SLICES(p->curpri);
  179. +        if (p->slices >= 0) {
  180. +            p->curpri = p->pri;
  181. +            p->slices = SLICES(p->curpri);
  182. +        }
  183.      }
  184.  }
  185.  
  186. @@ -307,11 +309,9 @@
  187.  void
  188.  run_next(p, slices)
  189.      PROC *p;
  190. -    int slices;    /* BUG: currently ignored */
  191. +    int slices;
  192.  {
  193. -    UNUSED(slices);
  194. -
  195. -    p->slices = 0;
  196. +    p->slices = -slices;
  197.      p->curpri = MAX_NICE;
  198.      p->wait_q = READY_Q;
  199.      p->q_next = sys_q[READY_Q];
  200. @@ -352,7 +352,7 @@
  201.      }
  202.      *lastq = proc;
  203.      proc->wait_q = que;
  204. -    if (que != READY_Q) {
  205. +    if (que != READY_Q && proc->slices >= 0) {
  206.          proc->curpri = proc->pri;    /* reward the process */
  207.          proc->slices = SLICES(proc->curpri);
  208.      }
  209. @@ -457,7 +457,12 @@
  210.              check_sigs();        /* check for signals */
  211.      }
  212.  
  213. -    proc_clock = TIME_SLICE;    /* get a fresh time slice */
  214. +    if (p->slices >= 0) {
  215. +        proc_clock = TIME_SLICE;    /* get a fresh time slice */
  216. +    } else {
  217. +        proc_clock = -p->slices;    /* slices set by run_next */
  218. +        p->curpri = p->pri;
  219. +    }
  220.      p->slices = SLICES(p->curpri);
  221.  }
  222.  
  223. 3. remove zombie when the real parent of a traced process woke up first
  224.  
  225. Index: dosmem.c
  226. @@ -1157,7 +1157,8 @@
  227.          /* deliver the signal to the tracing process first */
  228.              TRACE(("Pwaitpid(ptracer): returning status to tracing process"));
  229.              p->ptracer = NULL;
  230. -            return r;
  231. +            if (p->ppid != -1)
  232. +                return r;
  233.          }
  234.          else {
  235.          /* Hmmm, the real parent got here first */
  236.  
  237.  cheers
  238.     Juergen
  239. -- 
  240. J"urgen Lock / nox@jelal.north.de / UUCP: ..!uunet!unido!uniol!jelal!nox
  241.                                 ...ohne Gewehr
  242. PGP public key fingerprint =  8A 18 58 54 03 7B FC 12  1F 8B 63 C7 19 27 CF DA 
  243.